package cn.mldn.homework.mvcOutputHelloWord.DAO;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

public class HelloWorldDao implements DAO
{
	/*
	 * 从文件中读取再输出
	 */
	@Override
	public String getData()
	{
		try
		{
			InputStream is = new FileInputStream(new File("src/cn/mldn/homework/mvcOutputHelloWord/output.txt"));
			byte[] arr = new byte[1024];

			int len = 0;
			String str = null;
			while ((len = is.read(arr)) != -1)
			{
				str = new String(arr, 0, len);
			}
			return str;

		} catch (IOException e)
		{
			throw new RuntimeException(e.getMessage());
		}
	}
}